<?php
/**
 * PHP By Example
 *
 * @copyright 2014 Michel Corne <mcorne@yahoo.com>
 * @license   http://www.opensource.org/licenses/gpl-3.0.html GNU GPL v3
 */
?>

<h1>
  Test of <?=$this->_output->display_function_name();?>
  <?php require "$this->application_path/views/english_only.phtml";?>
</h1>

<?php require "$this->application_path/views/php_manual.phtml";?>

<div class="block blue_border">

  <?php if ($this->is_function_available !== true):?>
    <?=$this->is_function_available;?>

  <?php elseif (! $this->test_validations):?>
    This function or method is not tested

  <?php else:?>
    <table>

        <?php foreach ($this->test_validations as $example_id => $validation):
                  $status = $validation['status'];?>
          <tr>

            <td>Example #<?=$example_id + 1;?></td>

            <td>:</td>

            <td>
              <?php if ($status == 'test_success'):?>
                <span class="green">test success</span>
              <?php elseif ($status == 'test_not_validated'):?>
                <span class="gray">test not validated</span>
              <?php elseif ($status == 'test_failed'):?>
                <span class="red">test failed</span>
              <?php else:?>
                <span class="orange">test missing</span>
              <?php endif;?>
            </td>

          </tr>
        <?php endforeach;?>

      </table>
  <?php endif;?>

</div>

<?php if ($this->test_obsolete_count) :?>

  <div class="block red_border">
    <div>
      <span class="red">Warning! </span>

      <?php if ($this->test_obsolete_count == 1) :?>
        There is one obsolete test, please remove it or fix it!

      <?php else:?>
        There are <?=$this->test_obsolete_count;?> obsolete tests, please remove them or fix them!
      <?php endif;?>
    </div>
  </div>

<?php endif;?>

<?php $this->is_function_available === true and require "$this->application_path/views/test_validation.phtml";?>
